package com.tpp.Service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tpp.Service.cinemaService;


import com.tpp.dao.cinemaDao;
import com.tpp.pojo.TppCinema;
import com.tpp.pojo.baseVo.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class cinemaServiceImpl implements cinemaService {
@Autowired
com.tpp.dao.cinemaDao cinemaDao;



    @Override
    public BaseResult findAll(Integer page, Integer size) {
        PageHelper.startPage(page,size);
        List<TppCinema> cinemasList = cinemaDao.findall();
        PageInfo<TppCinema> of = PageInfo.of(cinemasList);
        BaseResult baseResult = new BaseResult();
        baseResult.setCode(1);
        baseResult.setData(of.getList());
        baseResult.setMsg("查询成功");
        return  baseResult;


    }

    @Override
    public BaseResult findBycinemaAdderssId(Integer id) {
        BaseResult baseResult = new BaseResult();
        TppCinema bycinemaAdderssId = cinemaDao.findBycinemaAdderssId(id);
        baseResult.setData(bycinemaAdderssId);
        baseResult.setCode(1);
        baseResult.setMsg("查询成功");
        return baseResult;
    }

    @Override
    public BaseResult findBycinemaAdderssIdandcinemaScore(Integer id, Double cinemaScore) {
        BaseResult baseResult = new BaseResult();
        TppCinema bycinemaAdderssIdandcinemaScore = cinemaDao.findBycinemaAdderssIdandcinemaScore(id, cinemaScore);
        baseResult.setCode(1);
        baseResult.setData(bycinemaAdderssIdandcinemaScore);
        baseResult.setMsg("成功");
        return baseResult;
    }
}
